--[[-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-10-9
-- Description: DO NOT EDIT; Code generated by "ipmi_message.lua.mako"
]] --
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local FirstIpmiCmd = {}

---@class Hello_openUBMCIpmiCmds.FirstIpmiCmdReq
---@field DataLen integer
---@field Data string
local TFirstIpmiCmdReq = {}
TFirstIpmiCmdReq.__index = TFirstIpmiCmdReq
TFirstIpmiCmdReq.group = {}

local function TFirstIpmiCmdReq_from_obj(obj)
    return setmetatable(obj, TFirstIpmiCmdReq)
end

function TFirstIpmiCmdReq.new(DataLen, Data)
    return TFirstIpmiCmdReq_from_obj({DataLen = DataLen, Data = Data})
end
---@param obj Hello_openUBMCIpmiCmds.FirstIpmiCmdReq
function TFirstIpmiCmdReq:init_from_obj(obj)
    self.DataLen = obj.DataLen
    self.Data = obj.Data
end

function TFirstIpmiCmdReq:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TFirstIpmiCmdReq.group)
end

TFirstIpmiCmdReq.from_obj = TFirstIpmiCmdReq_from_obj

TFirstIpmiCmdReq.proto_property = {'DataLen', 'Data'}

TFirstIpmiCmdReq.default = {0, ''}

TFirstIpmiCmdReq.struct = {
    {name = 'DataLen', is_array = false, struct = nil}, {name = 'Data', is_array = false, struct = nil}
}

function TFirstIpmiCmdReq:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'DataLen', self.DataLen, 'uint8', false, errs, need_convert)
    validate.Optional(prefix .. 'Data', self.Data, 'string', false, errs, need_convert)

    TFirstIpmiCmdReq:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TFirstIpmiCmdReq.proto_property, errs, need_convert)
    return self
end

function TFirstIpmiCmdReq:unpack(_)
    return self.DataLen, self.Data
end

FirstIpmiCmd.FirstIpmiCmdReq = TFirstIpmiCmdReq

---@class Hello_openUBMCIpmiCmds.FirstIpmiCmdRsp
---@field CompletionCode integer
---@field ManufactureId integer
local TFirstIpmiCmdRsp = {}
TFirstIpmiCmdRsp.__index = TFirstIpmiCmdRsp
TFirstIpmiCmdRsp.group = {}

local function TFirstIpmiCmdRsp_from_obj(obj)
    return setmetatable(obj, TFirstIpmiCmdRsp)
end

function TFirstIpmiCmdRsp.new(CompletionCode, ManufactureId)
    return TFirstIpmiCmdRsp_from_obj({CompletionCode = CompletionCode, ManufactureId = ManufactureId})
end
---@param obj Hello_openUBMCIpmiCmds.FirstIpmiCmdRsp
function TFirstIpmiCmdRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
end

function TFirstIpmiCmdRsp:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TFirstIpmiCmdRsp.group)
end

TFirstIpmiCmdRsp.from_obj = TFirstIpmiCmdRsp_from_obj

TFirstIpmiCmdRsp.proto_property = {'CompletionCode', 'ManufactureId'}

TFirstIpmiCmdRsp.default = {0, 0}

TFirstIpmiCmdRsp.struct = {
    {name = 'CompletionCode', is_array = false, struct = nil}, {name = 'ManufactureId', is_array = false, struct = nil}
}

function TFirstIpmiCmdRsp:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'CompletionCode', self.CompletionCode, 'uint8', false, errs, need_convert)
    validate.Optional(prefix .. 'ManufactureId', self.ManufactureId, 'uint32', false, errs, need_convert)

    TFirstIpmiCmdRsp:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TFirstIpmiCmdRsp.proto_property, errs, need_convert)
    return self
end

function TFirstIpmiCmdRsp:unpack(_)
    return self.CompletionCode, self.ManufactureId
end

FirstIpmiCmd.FirstIpmiCmdRsp = TFirstIpmiCmdRsp

return FirstIpmiCmd
